//! Copyright 2012 Xicut Technology, Inc.
//! All rights reserved
//!
#include "StrLib.h"
#include "HostDriver.h"


#if defined (__FW_BUILD__)
extern "C"  {
#include "stm32f10x.h"
#include "HIDDriver.h"
}
#endif

U8 cHIDDriver::s_pRecBuff[60+10];

/*******************************************************************************
* Function Name  : Init_Reset
* Description    : This function initialize USB driver and USB HID.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void cHIDDriver::Init_Reset()
{
#if defined (__FW_BUILD__)
    HIDDriverInit();
#endif
}


/*******************************************************************************
* Function Name  : GetIncomeMsg
* Description    : This function check income packed from USB
*                  requests.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
U8* cHIDDriver::GetIncomeMsg(U8 &iLen)
{
    U8 dataLen = 0;
#if defined (__FW_BUILD__)
    dataLen = HIDDriverCheckPackedIncome(s_pRecBuff);
#endif
    if ( 0 < dataLen )
    {
        iLen = dataLen;
        return (s_pRecBuff);
    }
    else
    {
        return (0);
    }
}



/*******************************************************************************
Function name: PCDriverSendPacked
Description: Send packed on USB
Input: None
Output: None
*******************************************************************************/
bool cHIDDriver::SendMsg(U8 *pOutData, U8 count)
{
#if defined (__FW_BUILD__)
    // Write the descriptor through the endpoint
    HIDDriverSendPacked(pOutData, count);
#endif

    return (true);
}


// end of file

